// 中转服务器操作
package main

import (
	"log"

	"github.com/libp2p/go-libp2p"
	"github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay"
)

func main() {
	run()
}

func run() {
	relay1, err := libp2p.New()
	if err != nil {
		log.Printf("主机创建失败: %v", err)
		return
	}

	_, err = relay.New(relay1)
	if err != nil {
		log.Printf("中转服务器配置失败: %v", err)
		return
	}
	log.Println("当前设备ID：", relay1.ID())
	for _, v := range relay1.Addrs() {
		log.Println("设备IP：", v.String())
	}
	select {}
}
